<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTestTemplatesTable extends Migration
{
    protected $tableName = 'test_templates';

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create($this->tableName, function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->comment('模版名称');
            $table->string('description')->comment('模板描述');
            $table->timestamps();

            $table->softDeletes();
        });
        DB::statement("ALTER TABLE `$this->tableName` comment '模版'");

        DB::table($this->tableName)->insert([
            'name' => 'template1',
            'description' => '卡片+译文'
        ]);
        DB::table($this->tableName)->insert([
            'name' => 'template2',
            'description' => '发音+译文'
        ]);
        DB::table($this->tableName)->insert([
            'name' => 'template3',
            'description' => '卡片+拼写'
        ]);
        DB::table($this->tableName)->insert([
            'name' => 'template4',
            'description' => '发音+选图'
        ]);
        DB::table($this->tableName)->insert([
            'name' => 'template5',
            'description' => '发音+拼写'
        ]);
        DB::table($this->tableName)->insert([
            'name' => 'template6',
            'description' => '发音+多选图'
        ]);
        DB::table($this->tableName)->insert([
            'name' => 'template7',
            'description' => '填词造句'
        ]);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists($this->tableName);
    }
}
